
import java.awt.event.*;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Mauricio
 */
public class FindListener implements ActionListener{
    private NewJPanel Panel;
    public FindListener(NewJPanel p){
        Panel=p;
    };
    public void actionPerformed(ActionEvent e){
      JMenuItem menuItem = (JMenuItem)(e.getSource());
      JTextListener te = new JTextListener(Panel);
      String text = menuItem.getText();
      if (text.equals("Por Usuario")) {
          Panel.getLabel().setText("Introduzca Usuario");
          Panel.getTextField().setText("Usuario");
          Panel.getTextField().addActionListener(te);
          Panel.getPanel().setVisible(true);
      }
      else if (text.equals("Por palabra clave")) {
          Panel.getLabel().setText("Introduzca palabra clave");
          Panel.getTextField().setText("Palabra Clave");
          Panel.getTextField().addActionListener(te);
          Panel.getPanel().setVisible(true);
      }
    };
}